<!--  -->
<template>
  <div class="home">
    <Header />
    <div class="container">
      <div class="router">
        <p>管理员</p>
        <router-link v-for="(item, idx) in list" :key="idx" :to="item.path">
          {{ item.name }}
        </router-link>
        <!-- <RouterList /> -->
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script>
import Header from "../../components/Header.vue";
export default {
  components: {
    Header,
  },
  // 组件状态值
  data() {
    return {
      list: [
        {
          path: "/housing",
          name: "房源管理",
        },
        {
          path: "/live",
          name: "直播管理",
        },
        {
          path: "/group",
          name: "团购管理",
        },
        {
          path: "/auditor",
          name: "审核管理",
        },
        {
          path: "/order",
          name: "订单管理",
        },
        {
          path: "/information",
          name: "资讯管理",
        },
        {
          path: "/broker",
          name: "经纪人管理",
        },
      ],
    };
  },
  // 计算属性
  computed: {},
  // 组件方法
  methods: {},
  /**
   * 组件实例创建完成，属性已绑定，但DOM还未生成，$ el属性还不存在
   */
  created() {},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<!--使用了scoped属性之后，父组件的style样式将不会渗透到子组件中，-->
<!--然而子组件的根节点元素会同时被设置了scoped的父css样式和设置了scoped的子css样式影响，-->
<!--这么设计的目的是父组件可以对子组件根元素进行布局。-->
<style lang="scss" scoped>
.home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  .router {
    width: 10%;
    display: flex;
    flex-direction: column;
    background: #001529;
    p {
      color: #999;
      text-align: center;
      line-height: 41px;
      margin-bottom: 15px;
    }
    a {
      line-height: 41px;
      color: #999;
      text-decoration: none;
    }
    .router-link-active {
      color: #fff;
    }
  }
  .content {
    flex: 1;
  }
}
</style>
